import request from "@/utils/request";
/**
 * 字典
 * companyMature(企业性质),companyScale(企业规模)
 */
export function returnCodeJson() {
  return [
    { label: "企业性质", value: "companyMature" },
    { label: "企业规模", value: "companyScale" }
  ];
}
// 分页查询
export function dictPageByQo(params) {
  return request({
    url: "/admin/dict/pageByQo",
    method: "post",
    params
  });
}
// 列表查询
export function dictListByQo(params) {
  return request({
    url: "/admin/dict/listByQo",
    method: "post",
    params
  });
}

// 删除
export function dictRemoveById(params) {
  return request({
    url: "/admin/dict/removeById",
    method: "post",
    params
  });
}

// 商品类别添加,修改
export function dictSaveOrUpdate(params) {
  return request({
    url: "/admin/dict/saveOrUpdate",
    method: "post",
    params
  });
}

/**
 * 账户管理
 */
// 分页查询
export function memberPageByQo(params) {
  return request({
    url: "/admin/member/pageByQo",
    method: "post",
    params
  });
}
// 列表查询
export function memberListByQo(params) {
  return request({
    url: "/admin/member/listByQo",
    method: "post",
    params
  });
}

// 添加、修改(type有值为修改)
export function memberSave(params, type) {
  return request({
    url: type ? "/admin/member/update" : "/admin/member/save",
    method: "post",
    params
  });
}

/**
 * 角色管理
 */
// 分页查询
export function rolePageByQo(params) {
  return request({
    url: "/admin/role/pageByQo",
    method: "post",
    params
  });
}
// 列表查询
export function roleListByQo(params) {
  return request({
    url: "/admin/role/listByQo",
    method: "post",
    params
  });
}

// 添加、修改(type有值为修改)
export function roleSave(params, type) {
  return request({
    url: type ? "/admin/role/update" : "/admin/role/save",
    method: "post",
    params
  });
}

// 角色管理批量删除
export function roleRemoveByIds(params) {
  return request({
    url: "/admin/role/removeByIds",
    method: "post",
    params
  });
}

// 详情
export function roleGetById(params) {
  return request({
    url: "/admin/role/getById",
    method: "post",
    params
  });
}

export function getRoleMenus(params) {
  return request({
    url: "/admin/role/getRoleMenus",
    method: "post",
    params
  });
}

export function editRoleMenus(params) {
  return request({
    url: "/admin/role/editRoleMenus",
    method: "post",
    params
  });
}

// 获取授权的菜单-功能权限
export function getPermissionMenu(params) {
  return request({
    url: "/admin/member/getPermissionMenu",
    method: "post",
    params
  });
}

/**
 * 站内信管理
 */
// 分页查询
export function messagePageByQo(params) {
  return request({
    url: "/dinner/message/pageByQo",
    method: "post",
    params
  });
}

// 获取未读数量
export function messageCountUnread() {
  return request({
    url: "/dinner/message/countUnread",
    method: "post"
  });
}

// 单个查询（详情）
export function messageGetById(id) {
  return request({
    url: "/dinner/message/getById",
    method: "post",
    params: {
      id
    }
  });
}

// 批量已读
export function messageRead(params) {
  return request({
    url: "/dinner/message/read",
    method: "post",
    params
  });
}

// 批量删除
export function messageRemoveByIds(params) {
  return request({
    url: "/dinner/message/removeByIds",
    method: "post",
    params
  });
}

// 查询订单状态
export function messageCheck(params) {
  return request({
    url: "/dinner/message/check",
    method: "post",
    params
  });
}
